#ifndef CTABLEQUICK_H
#define CTABLEQUICK_H

#include "AbsTable.h"
#include <QMetaEnum>
struct StQuick{
    QString id;
    QString session_id;
    QString text;
    bool    is_hex;
    int     span;
    QString name;


    StQuick loadData(QVariantList &varList)
    {
        if(varList.count() < 6){
            qWarning()<<"Size error!"<<varList.count()<<varList;
            return *this;
        }

        int nIndex = 0;
        id              = varList[nIndex++].value<QString>();
        session_id      = varList[nIndex++].value<QString>();
        text            = varList[nIndex++].value<QString>();
        is_hex          = varList[nIndex++].value<bool>();
        span            = varList[nIndex++].value<int>();
        name            = varList[nIndex++].value<QString>();
        return *this;
    }

    friend inline QDebug operator<<(QDebug &out, const StQuick& info)
    {
        out <<" StQuick("<<info.id<<info.session_id<<info.text<<info.is_hex<<info.span<<info.name<<") ";
        return out;
    }
};

class CTableQuick : public AbsTable
{
    Q_OBJECT
public:
    explicit CTableQuick(QObject *parent = nullptr);

    static CTableQuick* instance();

    enum Column{

    };

    bool createTable() override;

    bool deleteSession(QString strSessionId);
    bool addRows(QVector<StQuick> &vecRows);
    QVector<StQuick> queryRows(QString strSessionId);
};

#endif // CTABLEQUICK_H
